﻿using Abp.BackgroundJobs;
using Abp.Dependency;
using Abp.Domain.Repositories;
using apbmvc.model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace apbmvc.Hangfire
{
    /// <summary>
    /// 测试工作任务
    /// </summary>
    public class TestJob : BackgroundJob<int>, ITransientDependency
    {
        private readonly IRepository<companies, int> _companiesRepository;

        public TestJob(IRepository<companies, int> repository)
        {
            _companiesRepository = repository;
        }


        /// <summary>
        /// 执行的任何
        /// </summary>
        public override void Execute(int i)
        {
            var Count = _companiesRepository.Count();
            Logger.Debug("当前数据条数："+ Count);
            throw new Exception("我要让这条作业报错----------");
        }
    }
}
